// app.js
var util = require('./utils/util.js');
App({
  globalData: {
    userInfo: null,
    customBar: {
      width: 0,
      height: 0,
      top: 0,
      scrollH: 0
    },
  },
  onLaunch() {
    let that = this;
    //获取设备顶部窗口的高度（不同设备窗口高度不一样，根据这个来设置自定义导航栏的高度）
    let obj = wx.getMenuButtonBoundingClientRect();
    wx.getSystemInfo({
      success: (res) => {
        that.globalData.customBar.width = obj.left || res.windowWidth
        that.globalData.customBar.height = obj.top ? (obj.top + obj.height + 8) : (res.statusBarHeight + 44)
        that.globalData.customBar.top = obj.top ? (obj.top + (obj.height - 32) / 2) : (res.statusBarHeight + 6)
        that.globalData.customBar.scrollH = res.windowWidth * 0.6
        that.globalData.customBar.boxHeight = obj.height
      }
    })
  },
  skipPages(e) {
    wx.navigateTo({
      url: e,
      fail: (res) => {
        wx.reLaunch({
          url: e
        })
      }
    })
  },
})
